package cn.yann.demo.vertx.bus;

import io.vertx.core.AbstractVerticle;
import io.vertx.core.eventbus.EventBus;
import lombok.extern.slf4j.Slf4j;

/**
 * @author Yann
 */
@Slf4j
public class TcpReceiveBusVerticle extends AbstractVerticle {

    private static final String RECEIVE_MSG = "test-1";

    @Override
    public void start() throws Exception {

        EventBus eventBus = vertx.eventBus();
        log.debug("verticle bus实例: {}", eventBus);
        eventBus.consumer(RECEIVE_MSG, msg -> {
            log.debug("event bus 接收消息: {}", msg.body());
        });
    }
}
